unit i18nConfigForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure Memo1Click(Sender: TObject);
    procedure Memo1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
Var   BinStrMap:Array[0..1] of char=(' ','1');

implementation



{$R *.dfm}

Function IntToBin(Value:Integer; Digits:Integer):String;
Var a:Integer;
begin
SetLength(Result,Digits);
For a:=Digits downto 1 do
  begin
  Result[a]:=BinStrMap[Value mod 2];
  Value:=Value div 2;
  end;

end;

Function GetKeyName(nVK:Integer; Out S:String):Boolean;
Var nScanCode:Integer;
    a:Integer;
    NewWord:Boolean;
begin
nScanCode:=MapVirtualKeyEx(nVK, 0, GetKeyboardLayout(0));
case nVK of
VK_INSERT,
VK_DELETE,
VK_HOME,
VK_END,
VK_NEXT, // Page down
VK_PRIOR,// Page up
VK_LEFT,
VK_RIGHT,
VK_UP,
VK_DOWN:nScanCode := $100 or nScanCode; // Add extended bit
end;

  // GetKeyNameText() expects the scan code to be on the same format as WM_KEYDOWN
  // Hence the left shift
  SetLength(S,64);
  Result:=GetKeyNameText(nScanCode shl 16, @S[1], 64)<>0;
{  S:=AnsiLowerCase(S);
  NewWord:=true;
  For a:=1 to Length(S) do
    begin
    If (S[a] in [' ','(','-']) then
      NewWord:=true
    else
      begin
      If NewWord then
        begin
        S[a]:=AnsiUpperCase(S[a])[1];
        NewWord:=false
        end;
      end;
    end;}
end;


procedure TForm1.Memo1Click(Sender: TObject);
var a:Integer;
    text,s:String;
    Buff:PChar;
    W:Word;
    ScanCode:Integer;
begin
a:=0;
Buff:=StrAlloc(128);
repeat
Text:=Memo1.Lines.Strings[a];
Delete(Text,1,22);
ScanCode:=(MapVirtualKey(a,0) shl 16);
GetKeyName(a,s);
Text:=IntToStr(a)+': '+s;
Memo1.Lines.Add(Text);
inc(a);
until a=256;
StrDispose(Buff);
end;

procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
Var S:String;
begin
{Memo1.Clear;
GetKeyName(Key,S);
Memo1.Lines.Add(S);
Memo1.Lines.Add('');}

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1Click(self);
end;

end.
